package com.sunwoda.demo.utils;

import java.util.Random;

/**
 * Description:自动生成盐工具
 *
 * @author shiguorang
 * @date 2021-03-17 19:34:46
 */
public class SaltUtil {

    public static String getSalt(int number) {
        char[] charArray = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789~!@#$%^&*()_+-=*/".toCharArray();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < number; i++){
            sb.append(charArray[new Random().nextInt(charArray.length)]);
        }
        return sb.toString();
    }
}
